﻿@using Gx.Model.Entity
@model LKCustomerPrePayment
@{
    ViewBag.Title = "编辑客户预付款";
    Layout = "~/Views/Shared/InfoMaste.cshtml";
}
<script src="~/Js/Global.js"></script>
<script type="text/javascript">
    $(function () {
        InitCustomer();
        $('#CustomerId').combogrid('setValue', { Id: '@Model.CustomerId', CustomerName: '@Model.CustomerName' });
    });

    function querycustomer2() {
        $("#CustomerId").combogrid("grid").datagrid("reload", { "CustomerName": $("#SelectCustomerText2").val() });
    }


    function editLKCustomerPrePayment() {
        var validate = $("#fm").form("validate")
        if (!validate) {
            return;
        }
        var data = {
            "Id": $("#Id").val(),
            "BillNo": $("#BillNo").textbox('getValue'),
            "PrePayTime": $("#PrePayTime").datebox('getValue'),
            "CustomerId": $("#CustomerId").combobox('getValue'),//$("#hidCustomerId").val(),
            "CustomerNo": $("#CustomerId").combobox('getText'),
            "CustomerName": $("#CustomerName").textbox('getValue'),
            "PreAmount": $("#PreAmount").numberbox('getValue'),
            "Remark": $("#Remark").val()

        };
        var d = JSON.stringify({ LKCustomerPrePayment: data });
        $.messager.progress({
            title: '请稍后',
            msg: '数据保存中...',
        });
        window.setTimeout(function () {
            $.ajax({
                url: '/Finance/EditLKCustomerPrePayment',
                type: "post",
                data: d,
                contentType: 'application/json; charset=utf-8',
                success: function (json) {
                    $.messager.progress('close');
                    Helper.Show(json.Msg);
                    if (json.Success) {
                        setTimeout(function () { window.location.href = "/Finance/LKCustomerPrePaymentList"; }, 2000);
                    }
                }
            });
        }, 2000);
    }

</script>
<link href="~/Content/css/custome.css" rel="stylesheet" />
<div title="编辑客户预付款" style="width:auto; height:auto; padding-left:5px; font-size:14px;  ">
    <div class="ftitle">
        <a href="javascript:" class="easyui-linkbutton" iconCls="icon-ok" style="height:32px" onclick="editLKCustomerPrePayment()">保存</a>
        <a href="/Finance/LKCustomerPrePaymentList" class="easyui-linkbutton" iconCls="icon-back" style="height:32px">返回</a>
    </div>
    <form id="fm" method="post" novalidate>
        <input type="hidden" id="Id" value="@Model.Id" />
        <div class="ftitle">基础信息</div>
        <div class="fitem1">
            <label>
                单据编号:
            </label>
            <input name="BillNo" id="BillNo" class="easyui-textbox" readonly="readonly" value="@Model.BillNo" style="width: 173px; height: 30px;">
            <label>
                客户:
            </label>
            <select class="easyui-combogrid" style="width: 173px; height: 30px;" name="CustomerId" id="CustomerId"></select>
            <label>
                客户名称:
            </label>
            <input name="CustomerName" id="CustomerName" value="@Model.CustomerName" class="easyui-textbox" style="width: 173px; height: 30px;" readonly="readonly" />
        </div>
        <div class="fitem1">
            <label>
                时间:
            </label>
            <input class="easyui-datebox" name="PrePayTime" id="PrePayTime" value="@Model.PrePayTime" style="width: 173px; height: 30px; " data-options="required:true">
            <label>
                预付金额:
            </label>
            <input name="PreAmount" id="PreAmount" value="@Model.PreAmount" class="easyui-numberbox" data-options="required: true,precision:'2'" style="width: 173px; height: 30px;" autocomplete="off" />
        </div>
        <div class="fitem1">
            <label>
                备注:
            </label>
            <textarea rows="4" cols="4" style="width: 400px; height: 90px; vertical-align: top" name="Remark" id="Remark" autocomplete="off" placeholder="200字以内">@Model.Remark</textarea>
        </div>
        <div class="fitem1">
            @{
                var modifyuser = Model.ModifyUserId == 0 ? Gx.Dal.Shared.UserContext.CurrentUser.EmpName : Model.ModifyUser;
                var modifytime = Model.ModifyTime.ToString("yyyy-MM-dd") == "1911-01-01" ? "" : Model.ModifyTime.ToString("yyyy-MM-dd");
            }
            <label>
                制单人:
            </label>
            <label>
                @Model.CreateUser
            </label>

            <label>
                制单日期:
            </label>
            <label>
                @Model.CreateTime.ToString("yyyy-MM-dd")
            </label>
            <label>
                修改人:
            </label>
            <label>
                @modifyuser
            </label>
            <label>
                修改日期:
            </label>
            <label>
                @modifytime
            </label>
        </div>
    </form>

    <div id="customerselecttoolbar2">
        <input id="SelectCustomerText2" class="easyui-textbox " style="width: 173px; height: 30px;" />
        <a href="javascript:" class="easyui-linkbutton" plain="true" iconcls="icon-search" onclick="querycustomer2()">查询</a>
    </div>
</div>











